package br.jm.i18n;

import java.io.ObjectStreamException;
import java.io.Serializable;
import java.util.Locale;

public final class I18NResolver implements Serializable {

	private static final long serialVersionUID = 1L;

	final Class<?> messageClass;
	final Locale loc;

	public I18NResolver(final Class<?> messageClass, final Locale loc) {
		super();
		this.messageClass = messageClass;
		this.loc = loc;
	}

	public Object readResolve() throws ObjectStreamException {
		final I18NRepository repo = new I18NRepository(null);

		return repo.getProvider(messageClass, loc);
	}
}
